package com.example.communitypro.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

public class Comment implements Serializable {
    private Integer commentNo;

    private Integer communityNo;

    private Integer postNo;

    private Integer userNo;

    private Integer commentStatus;

    private Integer commentSort;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date commentTime;

    private Integer commentLikeNumber;

    private Integer commentCollectionNumber;

    private String commentContent;

    private Integer replyNo;

    private static final long serialVersionUID = 1L;

    public Integer getReplyNo() {
        return replyNo;
    }

    public void setReplyNo(Integer replyNo) {
        this.replyNo = replyNo;
    }

    public Integer getCommentNo() {
        return commentNo;
    }

    public void setCommentNo(Integer commentNo) {
        this.commentNo = commentNo;
    }

    public Integer getCommunityNo() {
        return communityNo;
    }

    public void setCommunityNo(Integer communityNo) {
        this.communityNo = communityNo;
    }

    public Integer getPostNo() {
        return postNo;
    }

    public void setPostNo(Integer postNo) {
        this.postNo = postNo;
    }

    public Integer getUserNo() {
        return userNo;
    }

    public void setUserNo(Integer userNo) {
        this.userNo = userNo;
    }

    public Integer getCommentStatus() {
        return commentStatus;
    }

    public void setCommentStatus(Integer commentStatus) {
        this.commentStatus = commentStatus;
    }

    public Integer getCommentSort() {
        return commentSort;
    }

    public void setCommentSort(Integer commentSort) {
        this.commentSort = commentSort;
    }

    public Date getCommentTime() {
        return commentTime;
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    public Integer getCommentLikeNumber() {
        return commentLikeNumber;
    }

    public void setCommentLikeNumber(Integer commentLikeNumber) {
        this.commentLikeNumber = commentLikeNumber;
    }

    public Integer getCommentCollectionNumber() {
        return commentCollectionNumber;
    }

    public void setCommentCollectionNumber(Integer commentCollectionNumber) {
        this.commentCollectionNumber = commentCollectionNumber;
    }

    public String getCommentContent() {
        return commentContent;
    }

    public void setCommentContent(String commentContent) {
        this.commentContent = commentContent == null ? null : commentContent.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Comment other = (Comment) that;
        return (this.getCommentNo() == null ? other.getCommentNo() == null : this.getCommentNo().equals(other.getCommentNo()))
                && (this.getCommunityNo() == null ? other.getCommunityNo() == null : this.getCommunityNo().equals(other.getCommunityNo()))
                && (this.getPostNo() == null ? other.getPostNo() == null : this.getPostNo().equals(other.getPostNo()))
                && (this.getUserNo() == null ? other.getUserNo() == null : this.getUserNo().equals(other.getUserNo()))
                && (this.getCommentStatus() == null ? other.getCommentStatus() == null : this.getCommentStatus().equals(other.getCommentStatus()))
                && (this.getCommentSort() == null ? other.getCommentSort() == null : this.getCommentSort().equals(other.getCommentSort()))
                && (this.getCommentTime() == null ? other.getCommentTime() == null : this.getCommentTime().equals(other.getCommentTime()))
                && (this.getCommentLikeNumber() == null ? other.getCommentLikeNumber() == null : this.getCommentLikeNumber().equals(other.getCommentLikeNumber()))
                && (this.getCommentCollectionNumber() == null ? other.getCommentCollectionNumber() == null : this.getCommentCollectionNumber().equals(other.getCommentCollectionNumber()))
                && (this.getCommentContent() == null ? other.getCommentContent() == null : this.getCommentContent().equals(other.getCommentContent()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCommentNo() == null) ? 0 : getCommentNo().hashCode());
        result = prime * result + ((getCommunityNo() == null) ? 0 : getCommunityNo().hashCode());
        result = prime * result + ((getPostNo() == null) ? 0 : getPostNo().hashCode());
        result = prime * result + ((getUserNo() == null) ? 0 : getUserNo().hashCode());
        result = prime * result + ((getCommentStatus() == null) ? 0 : getCommentStatus().hashCode());
        result = prime * result + ((getCommentSort() == null) ? 0 : getCommentSort().hashCode());
        result = prime * result + ((getCommentTime() == null) ? 0 : getCommentTime().hashCode());
        result = prime * result + ((getCommentLikeNumber() == null) ? 0 : getCommentLikeNumber().hashCode());
        result = prime * result + ((getCommentCollectionNumber() == null) ? 0 : getCommentCollectionNumber().hashCode());
        result = prime * result + ((getCommentContent() == null) ? 0 : getCommentContent().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", commentNo=").append(commentNo);
        sb.append(", communityNo=").append(communityNo);
        sb.append(", postNo=").append(postNo);
        sb.append(", userNo=").append(userNo);
        sb.append(", commentStatus=").append(commentStatus);
        sb.append(", commentSort=").append(commentSort);
        sb.append(", commentTime=").append(commentTime);
        sb.append(", commentLikeNumber=").append(commentLikeNumber);
        sb.append(", commentCollectionNumber=").append(commentCollectionNumber);
        sb.append(", commentContent=").append(commentContent);
        sb.append(", replyNo=").append(replyNo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}